package com.jjprojects.earutility;
import javax.swing.JTextArea;
import java.io.IOException;
import java.io.Writer;

/*
 * Created on Apr 18, 2005
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */

/**
 * @author U678864
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class TextAreaWriter extends Writer
{
    boolean boolTextAreaInitialized = false;
    private JTextArea txtaraEARFileViewer;

    public TextAreaWriter(JTextArea a)
    {
        txtaraEARFileViewer = a;
    }

    public void write(char[] chararrToWrite, int intOffset, int intLength) throws IOException
    {
        if (!boolTextAreaInitialized)
        {
            txtaraEARFileViewer.setText("");
            boolTextAreaInitialized = true;
        }
        txtaraEARFileViewer.append(new String(chararrToWrite, intOffset, intLength));
    }
    
    public void flush()
    {}

    public void close()
    {}
}